/*
 * TITLE:DebuggerHelp
 * AUTHOR:Manori Thakur
 * PURPOSE: Displays the Help section to player
 */
package com.example.android.debuggermenu;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

/*******************************************
 * @author Manori Thakur
 * AIM: This ListActivity displays all the online players to start the game after logging in. It also
 * contains a button 'Start Game' and the end of list.
 */

public class ListOnlinePlayers extends ListActivity {
    private ListView lView;
    private Button startView;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        startView = new Button(this); //creates the button after the list ends
        startView.setText("Start Game");
        
        lView = getListView();
        
	String[]onlineplayers = getResources().getStringArray(R.array.onlineplayers_array);

        lView.addFooterView(startView);//add the footer before setting adapter
        
	lView.setAdapter(new ArrayAdapter<String>(this,
	android.R.layout.simple_list_item_multiple_choice, onlineplayers));
	lView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);        
    }
}
    
    /** Start of Listener

lView.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView arg0, View arg1, int arg2,long arg3)

{

List list = new ArrayList();

SparseBooleanArray a = lView.getCheckedItemPositions();

for(int i = 0; i < lv_items.length ; i++)

{

if (a.valueAt(i))

{

Long val = lView.getAdapter().getItemId(a.keyAt(i));

Log.v(TAG, "index=" + val.toString());

list.add(lView.getAdapter().getItemId((a.keyAt(i))));

}

}

}

}); // End of Listener */

